package com.comac.print.component.app.command.cmdExe;

import com.alibaba.cola.dto.Response;
import com.alibaba.cola.dto.SingleResponse;
import com.comac.mom.simpleintegration.mq.MQProducerComponent;
import com.comac.print.component.app.common.PrintCommon;
import com.comac.print.component.app.gatewayimpl.database.mapper.MasterPlateMapper;
import com.comac.print.component.app.gatewayimpl.database.mapper.SystemMapper;
import com.comac.print.component.app.mqListener.PrintMessageListener;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class PrintRecordCmdExe {

    @Autowired
    MQProducerComponent mqProducerComponent;

    public Response create(PrintCommon printCommon) {
        //将打印请求信息推送到mq
        mqProducerComponent.sendMsg(getPrintTopicName(), printCommon);
        return SingleResponse.buildSuccess();
    }

    private String getPrintTopicName() {
        Component component = PrintMessageListener.class.getAnnotation(Component.class);
        String topic = component.value();
        return topic;
    }
}
